package com.kldy8.kldyw.logre;

import android.os.CountDownTimer;
import android.widget.Button;

/**
 * Created by Administrator on 2016/8/25.
 */
public class TimeCount extends CountDownTimer
{
    Button checking;
    public TimeCount(Button button , long millisInFuture, long countDownInterval)
    {
        super(millisInFuture, countDownInterval);//参数依次为总时长,和计时的时间间隔
        checking = button;
    }

    @Override
    public void onTick(long millisUntilFinished)
    {
        if (checking != null)
        {
            checking.setClickable(false);
            checking.setText(millisUntilFinished /1000+"秒");
        }
    }

    @Override
    public void onFinish() {
        if (checking != null)
        {
            checking.setClickable(true);
            checking.setText("重新验证");
        }
    }
}
